﻿namespace IceCS.DataStructure.Core.Stack
{
    /// <summary>
    /// 堆栈接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IStack<T>
    {
        /// <summary>
        /// 入栈操作
        /// </summary>
        /// <param name="data">元素</param>
        void Push(T data);

        /// <summary>
        /// 出栈操作
        /// </summary>
        /// <returns></returns>
        T Pop();

        /// <summary>
        /// 获取栈顶元素
        /// </summary>
        /// <returns></returns>
        T GetTop();

        /// <summary>
        /// 清空栈数据
        /// </summary>
        void Clear();

        /// <summary>
        /// 获取栈的长度
        /// </summary>
        /// <returns></returns>
        int Count { get; }

        /// <summary>
        /// 判断栈是否为空
        /// </summary>
        /// <returns></returns>
        bool IsEmpty { get; }

        /// <summary>
        /// 索引器
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        T this[int index] { get; }
    }
}
